function [hasil,hasil2] = heun3(f,f2,x0,y0,z0,b,h)
%HEUN fungsi menghitung nilai turunan dengan metode Heun
%   
    n = (b-x0) /h;
    y = y0;
    x = x0;
    z = z0;
    syms a b c;
    for r=1:n
        ys = y;
        y = y + h*subs(f,[a b c],[x y z]);                       %PREDICTOR dengan Euler
        y = ys + h/2 * (subs(f,[a b c],[x ys z]) + subs(f,[a b c],[x+h y z])); %CORRECTOR dengan Heun
        
        zs = z;
        z = z + h*subs(f2,[a b c],[x ys z]);                       %PREDICTOR dengan Euler
        z = zs + h/2 * (subs(f2,[a b c],[x ys zs]) + subs(f2,[a b c],[x+h ys z])); %CORRECTOR dengan Heun
        
        x = x + h;
    end
    hasil = y;
    hasil2 = z;
end

